package book;

import java.util.Date;

import common.TableManager;

public class ReserveBean {

	private int id;
	private Date reserveDate;
	private String bookIsbn;
	private String memberId;
	private BookBean bookBean;
	private member.MemberBean memberBean;
	private boolean mailFlag;

	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public Date getReserveDate() {
		return reserveDate;
	}
	public void setReserveDate(Date reserveDate) {
		this.reserveDate = reserveDate;
	}
	public String getBookIsbn() {
		return bookIsbn;
	}
	public void setBookIsbn(String bookIsbn) {
		this.bookIsbn = bookIsbn;
	}
	public String getMemberId() {
		return memberId;
	}
	public void setMemberId(String memberId) {
		this.memberId = memberId;
	}

	public BookBean getBookBean() {
		String sql="select * from books where isbn = '" + this.getBookIsbn()+"'";
		System.out.println(sql);
		this.bookBean=(BookBean)TableManager.getRecord(TableManager.BOOKS_TABLE, sql).getBean();
		return bookBean;
	}
	public member.MemberBean getMemberBean() {
		String sql = "select * from members where id = '" + this.getMemberId()+"'";
		this.memberBean=(member.MemberBean)TableManager.getRecord(TableManager.MEMBERS_TABLE, sql).getBean();
		return memberBean;
	}
	public boolean isMailFlag() {
		return mailFlag;
	}
	public void setMailFlag(int mailFlag) {
		if(mailFlag == 0) {
			this.mailFlag = false;
		}
		else {
			this.mailFlag = true;
		}
	}

}
